<include file="public:head" />

    <div class="container">

      <div class="row">

      	<div class="col-xs-12">

      		<div id="main1" style="width: 100%;height:400px;"></div>

      	</div>

      	<div class="col-xs-12">

      		<div id="main2" style="width: 100%;height:400px;"></div>

      	</div>

      	<div class="col-xs-12">

      		<div id="main3" style="width: 100%;height:400px;"></div>

      	</div>

      	<div class="col-xs-12">

      		<div id="main4" style="width: 100%;height:400px;"></div>

      	</div>

      	<div class="col-xs-12">

      		<div id="main5" style="width: 100%;height:400px;"></div>

      	</div>

        <div class="col-xs-12">

            <div id="main6" style="width: 100%;height:400px;"></div>

        </div>

      </div>

    </div>

<include file="public:foot" />

<script type="text/javascript">
var myChart1 = echarts.init(document.getElementById('main1'));
myChart1.setOption({
    title: {
        text: '可食'
    },
    tooltip: {},
    legend: {
        data:['可食比例']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 100
    },
    series: [{
        name: '可食比例',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata1(){
    $.ajax({
        url:"{:U('check/jsondata1')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].shibu);
                }
                myChart1.setOption({
			        xAxis: {
			            data: xx
			        },
			        series: [{
			            name: '可食比例',
			            data: yy
			        }]
			    });
            }
        }
    });
};
getdata1();

//
var myChart2 = echarts.init(document.getElementById('main2'));
myChart2.setOption({
    title: {
        text: '蛋白'
    },
    tooltip: {},
    legend: {
        data:['蛋白比例']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 100
    },
    series: [{
        name: '蛋白比例',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata2(){
    $.ajax({
        url:"{:U('check/jsondata2')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].danbai);
                }
                myChart2.setOption({
			        xAxis: {
			            data: xx,
                        max: 1284
			        },
			        series: [{
			            name: '蛋白比例',
			            data: yy
			        }]
			    });
            }
        }
    });
};
getdata2();

//
var myChart3 = echarts.init(document.getElementById('main3'));
myChart3.setOption({
    title: {
        text: '脂肪'
    },
    tooltip: {},
    legend: {
        data:['脂肪比例']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 100
    },
    series: [{
        name: '脂肪比例',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata3(){
    $.ajax({
        url:"{:U('check/jsondata3')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].zhifang);
                }
                myChart3.setOption({
			        xAxis: {
			            data: xx
			        },
			        series: [{
			            name: '脂肪比例',
			            data: yy
			        }]
			    });
            }
        }
    });
};
getdata3();

//
var myChart4 = echarts.init(document.getElementById('main4'));
myChart4.setOption({
    title: {
        text: '碳水'
    },
    tooltip: {},
    legend: {
        data:['碳水比例']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 100
    },
    series: [{
        name: '碳水比例',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata4(){
    $.ajax({
        url:"{:U('check/jsondata4')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].tanshui);
                }
                myChart4.setOption({
			        xAxis: {
			            data: xx
			        },
			        series: [{
			            name: '碳水比例',
			            data: yy
			        }]
			    });
            }
        }
    });
};
getdata4();

//
var myChart5 = echarts.init(document.getElementById('main5'));
myChart5.setOption({
    title: {
        text: '纤维'
    },
    tooltip: {},
    legend: {
        data:['纤维比例']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 100
    },
    series: [{
        name: '纤维比例',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata5(){
    $.ajax({
        url:"{:U('check/jsondata5')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].xianwei);
                }
                myChart5.setOption({
			        xAxis: {
			            data: xx
			        },
			        series: [{
			            name: '纤维比例',
			            data: yy
			        }]
			    });
            }
        }
    });
};
getdata5();

//
var myChart6 = echarts.init(document.getElementById('main6'));
myChart6.setOption({
    title: {
        text: 'VC'
    },
    tooltip: {},
    legend: {
        data:['VC含量']
    },
    xAxis: {
        data: []
    },
    yAxis: {
        max: 1000
    },
    series: [{
        name: 'VC含量',
        type: 'bar',
        data: []
    }]
});

var xx = [],yy = [];
function getdata6(){
    $.ajax({
        url:"{:U('check/jsondata6')}",
        async:false,
        dataType:'json',
        type:'post',
        success:function(msg){
            var res = msg.res;
            if(msg.code == 200){
                for(var i = 0 ; i < res.length; i++){
                    xx.push(res[i].name);
                    yy.push(res[i].vc);
                }
                myChart6.setOption({
                    xAxis: {
                        data: xx
                    },
                    series: [{
                        name: 'VC含量',
                        data: yy
                    }]
                });
            }
        }
    });
};
getdata6();

</script>